package com.cjf.androidstudy.component;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import com.cjf.androidstudy.utils.FileUtils;

import java.io.IOException;

public class ShutdownBroadcastReceiver extends BroadcastReceiver {
    private static final String TAG = "ShutdownBdReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "onReceive: Shutdown 关机.....");
        try {
            FileUtils.saveData(context, "shutdownData", "Shutdown 关机.....");
        } catch (IOException e) {
            Log.e(TAG, "onClick: ", e);
        }
        Toast.makeText(context, "Shutdown 关机", Toast.LENGTH_SHORT).show();
    }
}
